package com.xyz.mapper;

import com.xyz.entity.Mark;
import com.xyz.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MarkMapper {
    @Insert("INSERT INTO mark(userid,other_id) VALUES(#{userid}, #{otherId})")
    void addMark(Mark mark);
    @Delete("delete from mark where userid=#{userid} and other_id=#{otherId} ")
    void cancel(Mark mark);
//为什么没办法放进去
    @Select(" select  U.userid,U.username\n" +
            "                from user U, mark M\n" +
            "            where M.other_id=U.userid and M.userid=#{userid}")
    List<User> list(Integer userid);
}
